/**********************************************************************************************************************************
 * &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
 * %%%%%%%%%%%%%%%%             2011-6-13     【刘亚歌】                                                            %%%%%%%%%%%%%%%%
 * %%%%%%%%%%%%%%%%             论坛的javaScript方法                                                                %%%%%%%%%%%%%%%%
 * &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
 * ********************************************************************************************************************************
 */

/**
 * 添加板块分类
 */
function addTypeFun(viewBeanId){
	var sceneId = "bbs-manager-scene";
	var layoutId ="bbs-add-type";
	var viewBeanId = viewBeanId;
	var params = {
	    displayName:"新建板块分类",		
	    image16 : "icons/cog_add.png",
		width:500,
		height:200
	};
	SinoPortal.View.createWin(sceneId,layoutId,viewBeanId,params);	
}
/**
 * 打开编辑板块分类的窗口
 */
function toUpdateTypeFun(viewBeanId){
	var typeIds=""
	var item = document.getElementsByName("carTypeId");		
	for(i=0;i< item.length;i++){
	  if(item[i].checked){
		 typeIds= typeIds+ item[i].value+";"
	  }	      
	}
	var typeIdList = typeIds.split(";");	
	var typeIdlength = typeIdList.length;
    if(typeIdlength<2){
    	SinoPortal.Confirm.show("alert","小护士","请您选择一条记录，给您带来不便，请原谅!");
	}else	if(typeIdlength>2){
		SinoPortal.Confirm.show("alert","小护士","请您确定是否只选择了一条记录，给您带来不便，请原谅!");
	}else{
		var typeId = typeIdList[0];
		var sceneId = "bbs-manager-scene";
		var layoutId ="bbs-edit-type";
		var viewBeanId = viewBeanId;
		var params = {
			displayName:"编辑板块分类",		
			image16 : "icons/cog_edit.png",
			width:500,
			height:180,
			parment:"edit",
			typeId:typeId
		};
		SinoPortal.View.createWin(sceneId,layoutId,viewBeanId,params);	  
	}
}
/**
 * 删除板块分类
 */
function deleteType(viewBeanId){
	var typeUrl = viewBeanId+"_form:"+viewBeanId+"_dataTableId:"+"delTypeIds";
	var typeIds=""
	var item = document.getElementsByName("carTypeId");		
	for(i=0;i< item.length;i++){
	  if(item[i].checked){
		 typeIds= typeIds+ item[i].value+";"
	  }	      
	}
	var typeIdList = typeIds.split(";");	
	var typeIdlength = typeIdList.length;
	if(typeIdlength<2){
		SinoPortal.Confirm.show("alert","小护士","请您选择一条记录，给您带来不便，请原谅!");
	}else{
		 document.getElementById(typeUrl).value = typeIds;
	}
}
/**
 * 打开新建板块的窗口
 */
function addBodyFunction(viewBeanId){
	var sceneId = "bbs-manager-scene";
	var layoutId ="bbs-add-body";
	var viewBeanId = viewBeanId;
	var params = {
	    displayName:"新建板块",		
	    image16 : "icons/cog_add.png",
		width:530,
		height:340
	};
	SinoPortal.View.createWin(sceneId,layoutId,viewBeanId,params);		
}
/**
 * 打开编辑板块的窗口
 */
function openEditBodyWindow(viewBeanId){
	    var roleIds=""
	    var item = document.getElementsByName("love");		
	    for(i=0;i< item.length;i++){
	      if(item[i].checked)
	       roleIds= roleIds+ item[i].value+";"
	    }
	    var roleIdList = roleIds.split(";");	
		var roleIdlength = roleIdList.length;
		if(roleIdlength<2){
			SinoPortal.Confirm.show("alert","小护士","请您选择一条记录，给您带来不便，请原谅!");
		}else  if(roleIdlength>2){
			SinoPortal.Confirm.show("alert","小护士","请您确定是否只选择了一条记录，给您带来不便，请原谅!");
		}else{
			var bodyId = roleIdList[0];
			var sceneId = "bbs-manager-scene";
			var layoutId ="bbs-edit-body";
			var viewBeanId = viewBeanId;
			var params = {
			    displayName:"编辑板块",		
			    image16 : "icons/cog_add.png",
				width:540,
				height:340,
				bodyId:bodyId,
				parment:"editBody"
			};
			SinoPortal.View.createWin(sceneId,layoutId,viewBeanId,params);	
		}	
}
function deleteBody(viewBeanId){        
        var v = viewBeanId+"_form:"+viewBeanId+"_dataTableId:"+"roleIds";
        var bodyIds="";        
	    var item = document.getElementsByName("love");		
	    for(i=0;i< item.length;i++){
	      if(item[i].checked){
	    	  bodyIds= bodyIds+ item[i].value+";"
	      }	       
	    }
	    var bodyIdList = bodyIds.split(";");	
		var bodyIdlength = bodyIdList.length;
		if(bodyIdlength<2){
			SinoPortal.Confirm.show("alert","小护士","请您选择一条记录，给您带来不便，请原谅!");
		}else{
			document.getElementById(v).value = bodyIds;
		}	   
}


/**
 * 打开一个新的tab页，用于显示主题
 */
function openTopicListPage(viewBeanId,bodyId,bodyName){
	var sceneId = "bbs-manager-scene";
	var layoutId ="bbs-body-list";
	var params = {
		displayName:bodyName+"中的主题展示",		
	    image16 : "icons/cog_add.png",
		width:500,
		height:250,
		bodyId:bodyId
	};
	SinoPortal.View.createTab(sceneId,layoutId,viewBeanId,params);		
}
/**
 * 打开一个新建主题的页面
 */
function openAddTopic(viewBeanId){
	var sceneId = "bbs-manager-scene";
	var layoutId ="bbs-add-topic";
	var viewBeanId = viewBeanId;
	var params = {
	    displayName:"新建主题",		
	    image16 : "icons/cog_add.png",
		width:950,
		height:550
	};
	SinoPortal.View.createWin(sceneId,layoutId,viewBeanId,params);	
}
/**
 * 编辑一个主题的页面
 */
function openEditTopic(viewBeanId){
	var sceneId = "bbs-manager-scene";
	var layoutId ="bbs-edit-topic";
	var viewBeanId = viewBeanId;
	var params = {
	    displayName:"编辑主题",		
	    image16 : "icons/cog_add.png",
		width:950,
		height:550,
		parment:"update"
	};
	SinoPortal.View.createWin(sceneId,layoutId,viewBeanId,params);	
}
/**
 * 打开一个tab页，用于显示某个主题的所有回复信息
 */
function openTopicRec(viewBeanId){
	var sceneId = "bbs-manager-scene";
	var layoutId ="bbs-topic-rec";
	var params = {
	    displayName:"回复信息",		
	    image16 : "icons/cog_add.png",
	    parment:"view"
	};
	SinoPortal.View.createTab(sceneId,layoutId,viewBeanId,params);	
}
/**
 * 添加回复信息
 */
function openAddRec(topicName,viewBeanId,topicId){
	var sceneId = "bbs-manager-scene";
	var layoutId ="bbs-add-rec";
	var viewBeanId = viewBeanId;
	var params = {
	    displayName:topicName+"的回复信息",		
	    image16 : "icons/cog_add.png",
		width:950,
		height:530,
		topicId:topicId
	};	
	SinoPortal.View.createWin(sceneId,layoutId,viewBeanId,params);	
}
/**
 * 编辑回复信息
 */
function editRec(viewBeanId,recId){
	var sceneId = "bbs-manager-scene";
	var layoutId ="bbs-edit-rec";
	var viewBeanId = viewBeanId;
	var params = {
		    displayName:"编辑回复信息",		
		    image16 : "icons/cog_add.png",
			width:950,
			height:530,
			parment:"editRec",
			recId:recId
	};	
	SinoPortal.View.createWin(sceneId,layoutId,viewBeanId,params);
}
/**
 * 查询
 */
function openQuery(viewBeanId){
	var sceneId = "bbs-manager-scene";
	var layoutId ="bbs-query-page";
	var params = {
	    displayName:"查询信息",		
	    image16 : "icons/cog_add.png"
	};
	SinoPortal.View.createTab(sceneId,layoutId,viewBeanId,params);	
}

/**
 * 全部选中
 */
function checkAll(){ 
		var item = document.getElementsByName("love");
		for( var j=0;j<item.length;j++){
			item[ j ].checked = true
		}	
}
 /**
 *反选
 */
function unCheck(){
  	var item = document.getElementsByName("love");
		for( j=0;j<item.length;j++){
			item[j].checked = !item[j].checked
		}	
}